<?php
// 屏蔽PHP警告
error_reporting(E_ALL^E_NOTICE^E_WARNING);

require_once "jssdk.php";

// 设置子级账号的ID和秘钥
$jssdk = new JSSDK("wx359c80b9df8b5524", "48f41e8ab7682fa9c6bfa2c329e34100");
$signPackage = $jssdk->GetSignPackage();
?>

<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
		<title></title>
		<link type="text/css" rel="stylesheet" href="./index.css" />
		<script type="text/javascript" src="libs/requirejs.js" async="true" defer data-main="main"></script>

	</head>
	<body>
		<div id="wrap">

			<div id="content"></div>

			<div id="footer">
				<ul>
					<li>
						<a href="#home">
							<img src="zimg/1.png" />
							<span id="shouye">首页</span>
						</a>
					</li>
					<li>
						<a href="#shansong">
							<img src="zimg/2.png">
							<span>闪送超市</span>
						</a>
					</li>
					<li>
						<a href="#buybox">
							<img src="zimg/3.png">
							<span>购物车</span>
						</a>
					</li>
					<li>
						<a href="#mine">
							<img src="zimg/4.png">
							<span>我的</span>
						</a>
					</li>
				</ul>
			</div>
		</div>

	</body>
	<script type="text/javascript">
		(function (doc, win) {
		        var docEl = doc.documentElement,
		            resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
		            recalc = function () {
		                var clientWidth = docEl.clientWidth;
		                if (!clientWidth) return;
		                if(clientWidth==640){
		                    docEl.style.fontSize = '100px';
		                }else{
		                    docEl.style.fontSize = 100 * (clientWidth / 640) + 'px';
		                }
		            };

		        if (!doc.addEventListener) return;
		        win.addEventListener(resizeEvt, recalc, false);
		        doc.addEventListener('DOMContentLoaded', recalc, false);
		    })(document, window);
	</script>
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
	<script>
		wx.config({
			debug: true,
			appId: '<?php echo $signPackage["appId"];?>',
			timestamp: <?php echo $signPackage["timestamp"];?>,
			nonceStr: '<?php echo $signPackage["nonceStr"];?>',
			signature: '<?php echo $signPackage["signature"];?>',
			jsApiList: [
				// 所有要调用的 API 都要加到这个列表中
				'getLocation', 'openLocation','scanQRCode'
			]
		});

		wx.ready(function () {
				wx.scanQRCode({
						needResult: 0, // 默认为0，扫描结果由微信处理，1则直接返回扫描结果，
						scanType: ["qrCode","barCode"], // 可以指定扫二维码还是一维码，默认二者都有
						success: function (res) {
							var result = res.resultStr; // 当needResult 为 1 时，扫码返回的结果
						}
				});
		});
	</script>
</html>
